<?php
/**
 * RUBIK IT Solution & Development ltd.
 *
 * PROJECT		: Rubik Ultimate
 * @version 	: 1.1
 * COPYRIGHT	: 2008
 * ------------------------------------------------------
 * 
 * [GENERAL INFO OF THIS FILE] 
 *
 * @author			hoadn <hoadn@rubik.com.vn>
 * @access			[public/private]
 * @package		 [package name]
 *
 * Created on	:Sep 19, 2008
 */

// no direct access
defined ( '_FW_EXEC' ) or die ( 'Restricted access' );

class SwfConverter {
	
	/**
	 * The configuration folder that should be use for apply in linux or window
	 * @var string
	 */
	const EXE_FOLDER = 'win';
	
	/**
	 * 
	 * @param unknown_type $file
	 * @return unknown_type
	 */
	static function getExecFilePath($file) {
		return SYS_EXT_PATH. "swf" . DIRECTORY_SEPARATOR . self::EXE_FOLDER . DIRECTORY_SEPARATOR . "{$file}";
	} 
	
	/**
	 * Convert the pdf file to swf file
	 * 
	 * @param unknown_type $pdfSrc
	 * @param unknown_type $swfDes
	 * @param unknown_type $params
	 * @return boolean
	 */
	static function convertPdf2Swf($pdfSrc, $swfDes, $params = '') {
		$exeFile = self::getExecFilePath('pdf2swf.exe');
		$exeString = "{$exeFile} \"{$pdfSrc}\" \"{$swfDes}\" {$params}";
//		die($exeString);
		exec($exeString, $output, $return);
		return $output;
	}
}
?>